# encoding:utf-8
import os, unittest, HTMLTestRunner
suite = unittest.TestSuite()  # 创建测试套件
case_path = os.getcwd() #case所在路径
all_cases = unittest.defaultTestLoader.discover(case_path, '*Case.py')
# 找到某个目录下所有的以test开头的Python文件里面的测试用例
for case in all_cases:
    suite.addTests(case)  # 把所有的测试用例添加进来
fp = open('D://res.html', 'wb')
runner = HTMLTestRunner.HTMLTestRunner(stream=fp, title='测试用例', description='所有测试情况')
runner.run(suite)
# 运行测试